package com.example.webviewdemo;

import com.example.webviewdemo.slice.MainAbilitySlice;
import ohos.agp.components.webengine.JsCallback;
import ohos.agp.utils.LayoutAlignment;
import ohos.agp.window.dialog.ToastDialog;

public class JSAncroid implements JsCallback {


    private MainAbilitySlice context;
    public JSAncroid(MainAbilitySlice context) {
        this.context = context;
    }

    @Override
    public String onCallback(String s) {
        new ToastDialog(context)
                .setText("js 数据： " +s)
                .setAlignment(LayoutAlignment.CENTER)
                .show();
        return "返回结果";
    }

//    public void  test(String s){
//        new ToastDialog(context)
//                .setText("js 数据test： " +s)
//                .show();
//    }
}
